Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Problem obtaining Replication History via LotusScript on 64-bit OS
Feedback Type: Problem
Product Area: Domino Server
Technical Area: Application Development
Platform: Windows
Release: 8.5.2
Reproducible: Always

I am hoping that someone can help me with the problem when running a LotusScript that calls a Lotus C API and a Windows API to obtain the replication history of a domino application.

The script works fine when executed on a 32-bit or 64-bit Windows OS with a 32-bit Notes or Domino client. However, with 8.5.1 and 8.5.2, the Domino server can now be 64-bit. When the script runs on a 64-bit OS with a 64-bit Domino server, it fails.

I think the problem is with the handles that need to be passed to Windows API "RtlMoveMemory". I am not sure what has to be changed for the 64-bit OS. According to the Domino documentation, the handles are all still 32-bit within Domino, but I think the handles need to be 64-bit for the OS.

Can anyone help?

Here is the code (it is very similar to the sample code for the replication history):

Option Public
Option Declare

Type HIST_ENTRY
RepTime As String
ServerName As String
FileName As String
Direction As String
End Type
Type TIMEDATE1
Innards0 As Long
Innards1 As Long
End Type
Type REPLHIST_SUMMARY
ReplicationTime As TIMEDATE1
AccessLevel As Integer
AccessFlags As Integer
Direction As Integer
ServerNameOffset As Long
ServerNameLength As Integer
FileNameLength As Integer
Spare1 As Long
Spare2 As Long
End Type

Declare Private Function NSFDbOpen Lib "NNOTES" Alias "NSFDbOpen" (ByVal P As LMBCS String, H As Long) As Integer
Declare Private Function NSFDbClose Lib "NNOTES" Alias "NSFDbClose" (ByVal H As Long) As Integer
Declare Private Function OSPathNetConstruct Lib "NNOTES" Alias "OSPathNetConstruct" (ByVal NullPort As Long, ByVal Server As String, ByVal File As String, ByVal PathNet As String) As Integer
Declare Private Function NSFDbGetReplHistorySummary Lib "NNOTES" Alias "NSFDbGetReplHistorySummary" (ByVal H As Long, ByVal F As Long, retSum As Long, retNum As Long) As Integer
Declare Private Function OSMemFree Lib "NNOTES" Alias "OSMemFree" (ByVal H As Long) As Integer
Declare Private Function OSLockObject Lib "NNOTES" Alias "OSLockObject" (ByVal H As Long) As Long
Declare Private Function OSUnlockObject Lib "NNOTES" Alias "OSUnlockObject" (ByVal H As Long) As Integer
Declare Private Function OSLoadString Lib "NNOTES" Alias "OSLoadString" (ByVal hModule As Long, ByVal StringCode As Integer, ByVal retBuffer As String, BufferLength As Integer) As Integer
Declare Private Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDest As REPLHIST_SUMMARY, ByVal pSource As Long, ByVal dwLength As Long)
Declare Private Sub CopyMemoryStr Lib "kernel32" Alias "RtlMoveMemory" (ByVal pDest As String, ByVal pSource As Long, ByVal dwLength As Long)

Function GetReplHistory(db As NotesDatabase, sList() As String, lEntries As Long) As Integer
Dim hDB As Long, hLock As Long, hSummary As Long
Dim nLoop As Integer, nPos As Integer
Dim sPath As String, sHold As String, sTemp As String
Dim summary As REPLHIST_SUMMARY
Dim entry() As HIST_ENTRY
Dim eTemp As HIST_ENTRY
Dim nm As NotesName
Dim i As Long
Dim j As Long
Dim tb As String
Dim dtmdt As Double

tb = Chr(9)
GetReplHistory=0
sPath=Space(1024)

On Error GoTo processError
OSPathNetConstruct 0, db.Server, db.FilePath, sPath

GetReplHistory=NSFDbOpen(sPath, hDB)
If GetReplHistory <> 0 Then GoTo alldone
GetReplHistory=NSFDbGetReplHistorySummary(hDB, 0, hSummary, lEntries)
If GetReplHistory <> 0 Then GoTo alldone

If lEntries > 0 Then
ReDim entry(lEntries - 1)
hLock=OSLockObject(hSummary)
For nLoop=0 To lEntries-1
CopyMemory summary, hLock, LenB(summary)
dtmdt = (summary.ReplicationTime.innards1 And &HFFFFFF) - &H24D9AB + (summary.ReplicationTime.innards0 And &HFFFFFF)/24/360000
If Not (dtmdt < -657434 Or dtmdt > 2958465) Then
entry(nLoop).RepTime = Format(CDat(dtmdt),"yyyy/mm/dd hh:nn:ss") & " GMT"
Else
entry(nLoop).RepTime=""
End If
Select Case summary.Direction
Case 0
entry(nLoop).Direction="Never Received"
Case 1
entry(nLoop).Direction="Send"
Case 2
entry(nLoop).Direction="Receive"
Case Else
entry(nLoop).Direction="Unknown"
End Select
hLock=hLock+Lenb(summary)
Next

sHold=""
sTemp=String(1, 0)
nLoop=0
Do While nLoop < lEntries
CopyMemoryStr sTemp, hLock, 1
If sTemp = Chr(0) Then
nPos=InStr(1, sHold, "!!")
Set nm=New NotesName(Left(sHold, nPos-1))
entry(nLoop).ServerName=nm.Abbreviated
entry(nLoop).FileName=Right(sHold, Len(sHold)-nPos-1)
sHold=""
nLoop=nLoop + 1
Else
sHold=sHold & sTemp
End If
hLock = hLock + 1
Loop

OSUnlockObject(hSummary)
Do
j=0
For i=0 To lEntries-2
If entry(i).RepTime < entry(i+1).RepTime Then
j=j+1
eTemp=entry(i)
entry(i)=entry(i+1)
entry(i+1)=eTemp
ElseIf entry(i).RepTime = entry(i+1).RepTime Then
If entry(i).ServerName > entry(i+1).ServerName Then
j=j+1
eTemp=entry(i)
entry(i)=entry(i+1)
entry(i+1)=eTemp
End If
End If
Next
Loop While j > 0
ReDim sList(lEntries-1)
For nLoop=0 To lEntries-1
sList(nLoop)=Trim(entry(nLoop).ServerName & tb & entry(nLoop).FileName & tb & entry(nLoop).RepTime & tb & "(" & entry(nLoop).Direction & ")")
Next
End If

alldone:
If GetReplHistory <> 0 Then
lEntries = 1
ReDim sList(lEntries - 1)
If GetReplHistory = 578 Then
sList(0) = "No Replication History"
Else
sTemp = String(256, 0)
OSLoadString 0, GetReplHistory, sTemp, 255
sList(0) = Trim("Replication History Error: " & sTemp)
End If
End If

endfunc:
On Error GoTo 0
If hLock <> 0 Then OSUnlockObject(hSummary)
If hSummary <> 0 Then OSMemFree hSummary
If hDB <> 0 Then NSFDbClose hDB
Exit Function

' error handling routine
processError:
GetReplHistory = Err
sTemp = "Replication History Error: " & CStr(Err) & " on Line" & CStr(Erl) & ": " & Error$
lEntries = 1
ReDim sList(lEntries - 1)
sList(0) = sTemp
Resume endfunc

End Function


Feedback number WEBB8AHTUF created by ~Ned Mintoovitchettu on 10/23/2010

Status: Open
Comments:

Problem obtaining Replication Histo... (~Ned Mintoovitc... 23.Oct.10)
. . Same issue (~Cheryl Bubjumi... 23.Mar.11)
. . . . No solution yet (~Ned Mintoovitc... 13.May.11)
. . Perhaps a solution (~Sean Xanresako... 12.Sep.17)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS